package com.ken.mall.comm;

import org.apache.commons.lang3.StringUtils;

public class Const {

    public static final String CURRENT_USER = "currentUser";

    public static final String EMAIL = "email";

    public static final String USERNAME = "username";

    public static final String WX_OPEN_ID = "wxOpenId";

    public static final String CRM_USER_DEFAULT_PASSWORD="96E79218965EB72C92A549DD5A330112";

    public static Integer orderCount = 100;

    public static final String SERVICE_MESSAGE = "NICK_NAME 您好，您预约的SERVICE_CATEGORY_NAME 已在受理中，请您耐心等待并保持手机畅通。如需帮助请致电：400-021-1717";

    public static final String ANOTHER_STREETS = "其他街道";

    public static final String FORM_NAME_POSTFIX = "服务";

    public static final String SYS_CODE = "0000";

    public static final String SYS_NAME = "SYS";

    public static final int SYS_ID = 0;


    public interface MongoDbCollection{
        String FORM_DATA_COL = "jin_front_form_data";
        String FORM_STRUCTURE_COL = "jin_front_form_structure";
        String FORM_WORK_ORDER_MAPPING = "form_work_order_mapping";
        String FORM_SMS_TEMPLATE= "form_sms_template";
    }

    public interface CookieExtime{
        int COOKIE_EXTIME = 60 * 60 * 8;
    }
    public interface RedisCacheExtime{
        int REDIS_SESSION_EXTIME = 60 * 60 * 8;//8小时
        int REDIS_CRM_DATA_EXTIME = 60 * 60 * 12;
    }
    public interface Role{
        int ROLE_CUSTOMER = 0;
        int ROLE_ADMIN = 1;
    }

    public interface Cart{
        int CHECKED = 1;//购物车选中状态
        int UN_CHECKED = 0;//购物车未选中状态

        String LIMIT_NUM_FAIL = "LIMIT_NUM_FAIL";
        String LIMIT_NUM_SUCCESS = "LIMIT_NUM_SUCCESS";
    }

    public interface ProductStatus{
        int ON_SALE = 1;
        int UN_SALE = 0;
    }

    public interface RedisPrefix{
        String CRM_USER_PRE = "crm:user_id:";
        String CRM_USER_LOGIN_TOKEN = "crm:user:login:token:";
        String CRM_AREA_ID = "crm:area:id:";
        String JINFRONT_FORM_STRUCTURE = "jinfront:form:structure:";
        String CUSTOMER_LOGIN_SIGN = "customer:login:sign:";
        String CUSTOMER_LOGIN_TOKEN = "customer:login:token:";
        String WORK_ORDER_REPORT = "work_order_report:";
        String WX_ACCESSTOKEN = "wx:accesstoken:";
        String ACTOR_LOGIN_TOKEN = "actor_login_token:";
        String ACTOR_LOGIN_SIGN = "actor:login:sign:";

    }
    public enum CrmWorkOrderActionEnum{

            CREATED(0,"用户下单"),
            DISPATCHED(1,"安排服务"),
            VISIT(2,"需二次回访"),
            COMPLETE(3,"服务完成"),
            CANCELED(4,"服务取消"),
            REPAIR(5,"返修中"),
            COMPLAIN(6,"投诉处理中"),
            COMPLAIN_CLOSE(7,"投诉已解决"),
            RE_DISPATCHED(10,"重新安排"),
            DEFAULT(-1,"unknown");
    
            CrmWorkOrderActionEnum(int code,String value){
                this.code = code;
                this.value = value;
            }
            private String value;
            private int code;
    
            public String getValue() {
                return value;
            }
    
            public int getCode() {
                return code;
            }
    
            public static CrmWorkOrderActionEnum codeOf(int code){
                for(CrmWorkOrderActionEnum crmWorkOrderActionEnum : values()){
                    if(crmWorkOrderActionEnum.getCode() == code){
                        return crmWorkOrderActionEnum;
                    }
                }
                return DEFAULT;
            }
        }
    public enum AutoResultStatusEnum{

            UN_HANDLE(0,"未处理"),
            NEED_MANUAL(1,"需要人工派单"),
            AUTO(2,"已自动派单"),
            SMS_ERROR(3,"短信发送失败"),
            BEFORE_CREATE(4,"待创建"),
            CREATEING(5,"创建中"),
            CREATE_CANCEL(6,"未找到映射表"),
            CREATE_CUSTOMER_FAILD(7,"创建用户失败"),
            CREATE_ORDER_ERROR(8,"创建订单失败"),
            DEFAULT(-1,"unknown");
            AutoResultStatusEnum(int code,String value){
                this.code = code;
                this.value = value;
            }
            private String value;
            private int code;
    
            public String getValue() {
                return value;
            }
    
            public int getCode() {
                return code;
            }
    
            public static AutoResultStatusEnum codeOf(int code){
                for(AutoResultStatusEnum autoResultStatusEnum : values()){
                    if(autoResultStatusEnum.getCode() == code){
                        return autoResultStatusEnum;
                    }
                }
                return DEFAULT;
            }
        }
    public enum CrmOrderStatusEnum{
        PENDING(0,"处理中"),
        COMPLETE(2,"完成订单"),
        FAIleD(3,"失败订单"),
        COMPLAIN(4,"投诉订单"),
        FOLLOW(6,"需第二次跟踪"),
        REPAIR(7,"返修订单"),
        CREATED(10,"待受理"),
        DEFAULT(-1,"unknown");

        CrmOrderStatusEnum(int code,String value){
            this.code = code;
            this.value = value;
        }
        private String value;
        private int code;

        public String getValue() {
            return value;
        }

        public int getCode() {
            return code;
        }

        public static CrmOrderStatusEnum codeOf(int code){
            for(CrmOrderStatusEnum crmOrderStatusEnum : values()){
                if(crmOrderStatusEnum.getCode() == code){
                    return crmOrderStatusEnum;
                }
            }
            return DEFAULT;
        }
    }
    public enum CrmOrderSourcesEnum{
        ASK(0,"咨询"),
        NOTE(1,"单页、手册"),
        LU_JIA_ZUI(2,"陆家嘴中心"),
        WECHAT(3,"微信"),
        FU_XIN(28,"复星订单"),
        ACA(7,"中科院"),
        REPAIR(9,"尊堡园物业"),
        ZHUN_BAO(16,"安康通"),
        ZHONGYUAN(17,"中原地产"),
        LIN_LI(18,"邻里社区"),
        VIP(19,"VIP"),
        ZHI_HUI(20,"智汇坊"),
        LIN_QU(21,"邻趣"),
        WO_AI_WO_JIA(22,"我爱我家"),
        APP(23,"app"),
        SJGY(24,"尚景嘉愿"),
        FWR(25,"服务日订单"),
        ON_LINE(26,"在线订单"),
        ZHI_TONG(27,"直通订单"),
        DEFAULT(-1,"unknown");

        CrmOrderSourcesEnum(int code,String value){
            this.code = code;
            this.value = value;
        }
        private String value;
        private int code;

        public String getValue() {
            return value;
        }

        public int getCode() {
            return code;
        }

        public static CrmOrderSourcesEnum codeOf(int code){
            for(CrmOrderSourcesEnum crmOrderSourcesEnum : values()){
                if(crmOrderSourcesEnum.getCode() == code){
                    return crmOrderSourcesEnum;
                }
            }
            return DEFAULT;
        }
    }
    public enum CrmOrderVisitStateEnum{
        UN_VISIT(0,"未回访"),
        VISITING(1,"回访中"),
        VISITED(2,"已回访"),
        VISIT_FIED(3,"回访失败"),
        DEFAULT(-1,"unknown");

        CrmOrderVisitStateEnum(int code,String value){
            this.code = code;
            this.value = value;
        }
        private String value;
        private int code;

        public String getValue() {
            return value;
        }

        public int getCode() {
            return code;
        }

        public static CrmOrderVisitStateEnum codeOf(int code){
            for(CrmOrderVisitStateEnum crmOrderVisitStateEnum : values()){
                if(crmOrderVisitStateEnum.getCode() == code){
                    return crmOrderVisitStateEnum;
                }
            }
            return DEFAULT;
        }
    }
    public enum ComplainStatusEnum{
            OPEN(0,"已关闭"),
            CLOSE(1,"处理中"),
            DEFAULT(-1,"unknown");
    
            ComplainStatusEnum(int code,String value){
                this.code = code;
                this.value = value;
            }
            private String value;
            private int code;
    
            public String getValue() {
                return value;
            }
    
            public int getCode() {
                return code;
            }
    
            public static ComplainStatusEnum codeOf(int code){
                for(ComplainStatusEnum complainStatusEnum : values()){
                    if(complainStatusEnum.getCode() == code){
                        return complainStatusEnum;
                    }
                }
                return DEFAULT;
            }
        }

    public enum OrderStatusEnum{
        CANCELED(0,"已取消"),
        NO_PAY(10,"待付款"),
        PAID(20,"已付款"),
        PENDING(30,"待受理"),
        SHIPPED(40,"已受理"),
        ORDER_SUCCESS(50,"订单完成"),
        ORDER_CLOSE(60,"订单关闭"),
        ORDER_SECOND(70,"二次跟踪"),
        DEFAULT(-1,"unknown");

        OrderStatusEnum(int code,String value){
            this.code = code;
            this.value = value;
        }
        private String value;
        private int code;

        public String getValue() {
            return value;
        }

        public int getCode() {
            return code;
        }

        public static OrderStatusEnum codeOf(int code){
            for(OrderStatusEnum orderStatusEnum : values()){
                if(orderStatusEnum.getCode() == code){
                    return orderStatusEnum;
                }
            }
            return DEFAULT;
        }
    }

    public enum BrowserPlatFlagEnum{
        ALI_BROWSER("AlipayClient","支付宝访问的报文关键字"),
        WX_BROWSER("MicroMessenger","微信访问的报文关键字");
        private String userAgent;
        private String desc;

        BrowserPlatFlagEnum(String userAgent, String desc) {
            this.userAgent = userAgent;
            this.desc = desc;
        }

        public String getUserAgent() {
            return userAgent;
        }

        public void setUserAgent(String userAgent) {
            this.userAgent = userAgent;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    public interface WxPayCallBack{
        String RETURN_CODE = "SUCCESS";
        String RESULT_CODE = "SUCCESS";
    }

    public enum  PayPlatforEnum{
        ALI_NATIVE_PAY(1,"","支付宝扫码支付"),
        WX_MWEB_PAY(2,"MWEB","微信H5支付"),
        WX_APP_PAY(3,"APP","微信App支付"),
        WX_JSAPI_PAY(4,"JSAPI","微信公众号支付"),
        WX_NATIVE_PAY(5,"NATIVE","微信扫码支付"),
        DEFAULT(-1,"unknown","unknown");
        private int code;
        private String type;
        private String desc;

        PayPlatforEnum(int code, String type, String desc) {
            this.code = code;
            this.type = type;
            this.desc = desc;
        }

        public int getCode() {
            return code;
        }

        public void setCode(int code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public static PayPlatforEnum codeOf(int code){
            for (PayPlatforEnum payPlatforEnum : values()){
                if (payPlatforEnum.getCode() ==code){
                    return payPlatforEnum;
                }
            }
            return DEFAULT;
        }

        public static PayPlatforEnum typeOf(String type){
            for (PayPlatforEnum payPlatforEnum : values()){
                if (StringUtils.equals(payPlatforEnum.getType(),type)){
                    return payPlatforEnum;
                }
            }
            return DEFAULT;
        }
    }

    public enum PaymentTypeEnum{
        ONLINE_PAY(1,"在线"),
        UNLINE_PAY(2,"线下"),
        DEFAULT(-1,"unknown");
        private int code;
        private String value;
        PaymentTypeEnum(int code,String value){
            this.code = code;
            this.value = value;
        }

        public int getCode() {
            return code;
        }

        public String getValue() {
            return value;
        }

        public static PaymentTypeEnum codeOf(int code){
            for (PaymentTypeEnum paymentTypeEnum : values()){
                if (paymentTypeEnum.getCode() ==code){
                    return paymentTypeEnum;
                }
            }
            return DEFAULT;
        }
    }

    public interface WxApi{
        /** 获取微信用户授权token*/
        String ACCREDIT_TOKEN_URL="https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";

    }



}
